/**
 * @description $column.type == 普
 * 普通文本
 */

import { Form, Input } from 'antd';
import getDisabled from '../getDisabled';
import getRule from '../getRule';

function YyText({ column, disabledColumnNames, showLabel }) {

  // [1] 配置校检rules字段。column已经有rules则取，无则重新生成
  let rules = column.rules ? column.rules : getRule(column)

  // [2] 配置disabled字段
  let disabled = getDisabled(column) || disabledColumnNames.includes(column.columnName)

  return (
    <Form.Item
      label={showLabel ? column.comments : null}
      name={column.columnName}
      rules={rules}

    >
      <Input disabled={disabled} placeholder={column.placeholder} allowClear />
    </Form.Item >
  )
}

export default YyText